package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.DataStatus;
import com.ygqh.baby.ao.PromotionType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.model.*;
import com.ygqh.baby.po.YgSku;
import com.ygqh.baby.po.YgSkuExample;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface YgSkuMapper {
    int countByExample(YgSkuExample example);

    int deleteByExample(YgSkuExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgSku record);

    int insertSelective(YgSku record);

    List<YgSku> selectByExample(YgSkuExample example);

    YgSku selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgSku record, @Param("example") YgSkuExample example);

    int updateByExample(@Param("record") YgSku record, @Param("example") YgSkuExample example);

    int updateByPrimaryKeySelective(YgSku record);

    int updateByPrimaryKey(YgSku record);

    int countSuper(@Param("q") String q);

    List<YgSku> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("q") String q);

    int saveBatch(List<YgSku> skus);

    Long[] findSkuIdsByGroupId(@Param("groupId") Long groupId);

    Long[] findSkuIdsWithBrandAndCategory(@Param("productId") Long productId);

    Long[] findSkuIdsWithBrandOrCategory(@Param("productId") Long productId);

    int insertSkuInBatch(@Param("skuList") List<YgSku> skuList);

    YgOrder4ImportModel findOrder4ImportModel(@Param("skuCode") String skuCode);

    List<YgSku> selectBySkuCode(@Param("skuCode") String skuCode, @Param("type") PromotionType type);

    void updateSkuPrice(@Param("list") List<YgSku> list);

    void updateSkuSalesPrice(@Param("productId") Long productId, @Param("salesPrice") BigDecimal productSalePrice, @Param("vipPrice") BigDecimal vipPrice,
                             @Param("promotionPrice") BigDecimal promotionPrice, @Param("distributionPrice") BigDecimal distributionPrice);

    List<YgSkuTemplate> findSkuTemplate();

    List<YgSku> selectByProductCode(@Param("productCode") String productCode, @Param("type") PromotionType type);

    List<YgSku> selectWithStock(@Param("productId") Long productId, @Param("sizeName") String sizeName);

    void updateCostPrice(@Param("list") List<YgSku> list);

    List<Map<String, Object>> selectSkuCost(@Param("productCode") String productCode, @Param("productName") String productName,
                                            @Param("skuCode") String skuCode, @Param("groupId") Long groupId);

    int updateByProductId(@Param("ygSku") YgSku ygSku);

    void updatePromotionPrice(@Param("promotionPrice") BigDecimal promotionPrice, @Param("id") Long id, @Param("updateBy") String updateBy,
                              @Param("updateTime") Date updateTime, @Param("vipRate") BigDecimal vipRate, @Param("distributionPrice") BigDecimal distributionPrice);

    List<String> selectSkuCodes(@Param("productIds") List<String> productIds);

    List<YgSkuReport> getSkuReport(@Param("productCode") String productCode, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    YgSkuInfo getSkuInfo(@Param("skuCode") String skuCode, @Param("pType") PromotionType pType);

    List<YgSkuInfo> getSkuInfoList(@Param("productIds") List<String> productIds);

    List<YgSkuInfo> selectSkuInfoList(@Param("queryInfo") QueryInfo queryInfo, @Param("productName") String productName,
                                      @Param("productCode") String productCode, @Param("supplierId") Long supplierId, @Param("hasSkuSupplierPrice") Boolean hasSkuSupplierPrice);

    int countSkuInfo(@Param("productName") String productName, @Param("productCode") String productCode, @Param("supplierId") Long supplierId,
                     @Param("hasSkuSupplierPrice") Boolean hasSkuSupplierPrice);

    YgSkuInfo selectSkuInfoById(@Param("id") Long id);

    List<YgSkuInfo> selectSkuInfoListByIds(@Param("skuIds") List<Long> skuIds);

    SkuBasicData getSkuBasicDataBySkuId(@Param("skuId") Long skuId);

    SkuBasicData getSkuBasicDataBySkuCode(@Param("skuCode") String skuCode);

    Long selectMaxSkuCode(@Param("productCode") String productCode);

    List<SkuBasicData> getBasicDataList(@Param("pType") PromotionType pType, @Param("productName") String productName, @Param("barCodes") String[] barCodes,
                                        @Param("skuCodes") String[] skuCodes, @Param("dataStatus") DataStatus dataStatus);

    List<YgSku> selectSizeInfoHasStockByProductIds(@Param("productIds") String[] productIds);

    int hasDiffPrice(@Param("productId") Long productId);

    YgSkuInfo selectSkuInfoBySkuCode(@Param("skuCode") String skuCode, @Param("pType") PromotionType pType);
}
